﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QInfrastructure.Models;
#nullable disable

public interface IEntity
{

}

public interface IEntity<T> : IEntity
{
    T Id { get; set; }
    bool IsNew { get; }
}

public abstract class GuidPKEntity : IEntity<Guid>, IEntity
{
    public Guid Id { get; set; }

    public bool IsNew => Id == Guid.Empty;
}

public abstract class IntPKEntity : IEntity<int>, IEntity
{
    public int Id { get; set; }

    public bool IsNew => Id <= 0;
}

public abstract class StringPKEntity : IEntity<string>, IEntity
{
    public string Id { get; set; }
    public bool IsNew=>string.IsNullOrWhiteSpace(Id);
}
